#include "aviodSensor.hpp"

forearmA* forearmA::p = RT_NULL;
forearmB* forearmB::p = RT_NULL;
backarmA* backarmA::p = RT_NULL;
backarmB* backarmB::p = RT_NULL;

/**
 * @brief 
 * @return forearmA& 
 */
forearmA& forearmA::instance()
{
    if(p==RT_NULL)
    {
        p = new forearmA(FOREARM_A_PIN, robot_devio::input);
        p->open();
    }
    return *p;
}

rt_sem_t forearmA::get_sem()
{
    return &irq_sem;
}

/**
 * @brief 
 * @return forearmB& 
 */
forearmB& forearmB::instance()
{
    if(p==RT_NULL)
    {
        p = new forearmB(FOREARM_B_PIN, robot_devio::input);
        p->open();
    }
    return *p;
}

rt_sem_t forearmB::get_sem()
{
    return &irq_sem;
}


/**
 * @brief 
 * @return backarmA& 
 */
backarmA& backarmA::instance()
{
    if(p==RT_NULL)
    {
        p = new backarmA(BACKARM_A_PIN, robot_devio::input);
        p->open();
    }
    return *p;
}

rt_sem_t backarmA::get_sem()
{
    return &irq_sem;
}


/**
 * @brief 
 * @return backarmB& 
 */
backarmB& backarmB::instance()
{
    if(p==RT_NULL)
    {
        p = new backarmB(BACKARM_B_PIN, robot_devio::input);
        p->open();
    }
    return *p;
}

rt_sem_t backarmB::get_sem()
{
    return &irq_sem;
}
